{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0009f488-4464-4ed3-befc-6ed4b4e4fde6",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from numpy import * \n",
    "a=[1,1,1]\n",
    "b=[2,2,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "581889cf-3894-4ec5-bffd-6b235a2f5fe7",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=array(a)\n",
    "b=array(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "35d5dc82-cab5-49e1-8162-efaef196f2eb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 1, 2, 2, 2])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hstack((a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "1cd2ef81-074c-4980-827e-57c0f17ba883",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 1, 1],\n",
       "       [2, 2, 2]])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vstack((a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "2da1fa9c-3bc6-43a8-9c18-899f7030dfe3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0]])"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aa = full((1,3),0)\n",
    "aa"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "99abccbd-b7d2-452e-910b-cdeedb5caa25",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 1, 1]])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bb = full((1,3),1)\n",
    "bb "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "e4cb0929-51f7-42c7-9d77-6f5e855aa48a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0],\n",
       "       [1, 1, 1]])"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vstack((aa,bb))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "849d1532-ed7f-4765-9e81-fc5adf3cd651",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, 1, 1, 1]])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hstack((aa,bb))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "107dac01-774b-4df5-8783-0f4724eea3ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0],\n",
       "       [0, 0, 0]])"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aa2 = full((2,3),0)\n",
    "aa2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "5c85e6bd-059e-4ae5-942e-dd2dcf1c8330",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 1, 1],\n",
       "       [1, 1, 1]])"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bb2 = full((2,3),1)\n",
    "bb2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "98782573-6add-4a32-9045-c199ae8c4618",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, 1, 1, 1],\n",
       "       [0, 0, 0, 1, 1, 1]])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hstack((aa2,bb2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "1d7313ee-0b40-4b63-818e-fe66f726b0dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0],\n",
       "       [0, 0, 0],\n",
       "       [1, 1, 1],\n",
       "       [1, 1, 1]])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vstack((aa2,bb2))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b23051d2-2c0b-4bef-8694-cb7286c69688",
   "metadata": {},
   "source": [
    "使用concatenate函数\n",
    "https://www.bilibili.com/video/BV1BA41197ZU?spm_id_from=333.788.videopod.episodes&vd_source=f69fe937b6744667b35fadd0fa06ddd2&p=44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "6970901d-c5bd-4542-8bfa-076f48cf4e87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2],\n",
       "       [3, 4],\n",
       "       [5, 6]])"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a= [[1,2],[3,4]]\n",
    "b=[[5,6]]\n",
    "concatenate((a,b),axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "f168a935-e89c-4af2-8580-e9cd3a8f5c42",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2],\n",
       "       [3, 4],\n",
       "       [5, 6]])"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vstack((a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "8c361e5d-0a2c-4616-973e-b19da8ed8d0e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 5],\n",
       "       [3, 4, 6]])"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a= [[1,2],[3,4]]\n",
    "b=[[5],[6]]\n",
    "concatenate((a,b),axis=1)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
